package com.zxing.dubbo.custom.controller;

import com.zxing.dubbo.interfaces.dto.ResponseDTO;
import com.zxing.dubbo.interfaces.dto.test.User;
import com.zxing.dubbo.interfaces.inter.TestInter;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class TestController {

    @DubboReference
    private TestInter testInter;
    @Value(value = "${user.extra}")
    private String userExta;

    @GetMapping("/test")
    public ResponseDTO<User> test(){
        ResponseDTO<User> dto = testInter.test();
        dto.getBody().setExtra(userExta);
        return dto;
    }
}
